<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<html >
<head>
	<title></title>
	<%@ include file="/common/meta.jsp" %>
	<link type="text/css" rel="stylesheet" href="${ctx}/frame/images/style.css" />
	<link type="text/css" rel="stylesheet" href="${ctx}/css/cupertino/jquery-ui-1.8.13.custom.css" />
	<script type="text/javascript" src="${ctx}/js/weboffice/main.js"></script>
	<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx}/css/cupertino/jquery-ui-1.8.13.custom.min.js" type="text/javascript"></script>
	<script src="${ctx}/css/cupertino/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
	<script src="${ctx}/js/tree/MzTreeView11.js" type="text/javascript"></script>
	<script src="${ctx}/js/DlgCtrl.js" type="text/javascript"></script>
	<script src="${ctx}/js/function.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	background-color:white;
    margin:5px;
    overflow:auto;
}
-->
</style>
<SCRIPT LANGUAGE=javascript FOR=WebOffice1 EVENT=NotifyCtrlReady>
/****************************************************
*
*	在装载完Weboffice(执行<object>...</object>)
*	控件后执行 "WebOffice1_NotifyCtrlReady"方法
*
****************************************************/
	WebOffice1_NotifyCtrlReady();
</SCRIPT>
<script type="text/javascript">
	$(document).ready(function(){
		initButton();
		var typeCtrl = new DlgCtrl();
		typeCtrl.bindCtrl("MEDIC_PRJ_AREA","typeName","typeid","radio","ID");
		
		
		//typeCtrl.url=ctx+"/sys/organization-ui!getOrgByCode.action?";
		//typeCtrl.checkParent = false;
		//typeCtrl.bindCtrl("GD_MEDIC","orgname","orgid","radio","ID");
		DateFor("applyDate");
		});

	function WebOffice1_NotifyCtrlReady(){
		var docType = "doc";
		var docId = "${id}";
		
		var office = $("#WebOffice1").get(0);	
			
		//新建空文档		
		if(docId==""){
			office.LoadOriginalFile("",docType);
		}
		else{
			//载入文档
			var fileId = "${project.prjFile[0].id}";
			var url="../project/prj-file!getFile.action?id="+fileId;
			office.LoadOriginalFile(url,docType);
			}
		
		//隐藏菜单栏
		notMenu();
		}

	function saveCurrDoc(){
		var url="../project/prj-file!save.action";
		var id = "${project.prjFile[0].id}";
		var office = $("#WebOffice1").get(0);
		var title = $("#prjName").val();
		url+="?title="+encodeURI(title);
		office.HttpInit();	
		office.HttpAddPostString("id",id);
		office.HttpAddPostCurrFile("docFile","");
		var str = office.HttpPost(url);
		if("true"!=str){
			alert("保存文件时出错！");
			return false;
			}
		return true;
		}
	//设置按钮样式
	 function initButton(){
		$("input:button,input:submit").button();
		 };

	
	
</script>

</head>

<body>
<form id="inputForm" action="project!save.action" method="post" onsubmit="return saveCurrDoc();">
<input type="hidden" name="id" value="${id}"/>
	<div id="ptop">
	<div id="tleft"></div>
	<div id="ticon"><img src="../frame/images/icon_list.gif"/>&nbsp;</div>
	<div id="ttitle"><s:if test="id == null">创建</s:if><s:else>修改</s:else>项目</div>
	<div id="tright"></div>
	</div>
	
	<div id="pmain">
		<div class="errdiv"><span class="error"><s:fielderror/><s:actionerror/> </span></div>
		<table class="fm"  cellPadding="0" cellSpacing="0" style="width:85%">	
			<thead>
				<th colspan="7" height="25" >
				<div class="fmedit"></div>
				<div style="width:60px;"><s:if test="id == null">创建</s:if><s:else>修改</s:else>项目</div>
				<div class="fmdot"></div>				
				</th>
			</thead>	
			<tr>
				<td class="fmtt">项目名称</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl" colspan="5" align="left">&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="text" class="fmtxt" name="prjName" size="120" id="prjName" value="${prjName}"/>
				 </td>
			</tr>
			
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>
			<tr>
				<td class="fmtt">简称</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl" colspan="5" align="left">&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="text" id="shortName" name="shortName" size="80" value="${shortName}"/>
				 </td>
			</tr>
			
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>
			
			<tr>
				<td class="fmtt">申请人</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl" width="40%">
				
					<s:if test="id == null ">
						<input type="hidden" id="userid" name="userId" size="40" value="${currUser.id}"/>
						<input type="text"  class="fmtxt" id="username" name=""  value="${currUser.name}"/>
					</s:if>
					<s:else>
					<input type="hidden" id="userid" name="userId" size="40" value="${project.user.id}"/>
					<input type="text" class="fmtxt" id="username" name="" value="${project.user.name}"/>				
					</s:else>
				 </td>
				<td class="fmve"><div></div></td>
				<td class="fmtt" width="20%">所在单位</td>
				<td class="fmve" ><div></div></td>
				<td class="fmctrl" width="40%">
					<s:if test="id == null">
					<input type="hidden" id="orgid" name="orgId"  value="${currUser.organization.id}"/>
					<input type="text" class="fmtxt" readonly="readonly" id="orgname" name="project.organization.nodeName"  value="${currUser.organization.name}"/>
					</s:if>
					<s:else>
					<input type="hidden" id="orgid" name="orgId"  value="${project.organization.id}"/>
					<input type="text" class="fmtxt" readonly="readonly" id="orgname" name="project.organization.nodeName"  value="${project.organization.name}"/>
					</s:else>
				</td>
			</tr>
			
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>
			<tr>
				<td class="fmtt">申请时间</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl">
					<input type="text" class="fmtxt" id="applyDate" name="applyDate" size="20" value="<s:date name="applyDate" format="yyyy-MM-dd"/>"/>
				</td>
				<td class="fmve"><div></div></td>
				<td class="fmtt">项目类型</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl">
					<input type="hidden" id="typeid" name="sysClassId" size="20" value="${project.sysClass.id}"/>
					<input readonly="readonly" type="text" class="fmtxt" id="typeName" name="project.sysClass.name" value="${project.sysClass.name}"/>
				</td>
			</tr>
			
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>
			<tr>
				<td class="fmtt">备注</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl" colspan="5" align="left">

				<textarea cols="70" rows="5" name="note" id="note">${note }</textarea>
	
				 </td>
			</tr>
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>
			
			<tr>
				<td class="fmtt">项目概要说明</td>
				<td class="fmve"><div></div></td>
				<td class="fmctrl" colspan="5" align="left">
				<textarea cols="70" rows="15" id="summarize" name="summarize">${summarize }</textarea>
				 </td>
			</tr>
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>
						
			<tr>
				<td class="fmtt" style="width:100%" colspan="7" ><strong> 申 报 内 容  </strong></td>
			</tr>
			<tr>
				<td colspan="7" class="fmhor"></td>
			</tr>		
			<tr>
				<td colspan="7"  class="fmctrl"><script type="text/javascript" src="${ctx}/js/weboffice/LoadWebOffice.js"></script></td>
			</tr>
			
			<tr>
				<td  colspan="7" class="fmbtm" >
						<input class="button" type="submit" value=" 提 交 " />&nbsp;
					<input class="button" type="button" value="返 回 " onclick="history.back()"/>
				</td>
			</tr>
		</table>
	</div>
		</form>
	
</body>
</html>
